﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="ReportMagazzino.aspx.cs" Inherits="FimetContoDeposito.Operazioni.ReportMagazzino" %>

<%@ Register assembly="GrayParrot.Web.Controls" namespace="GrayParrot.Web.Controls" tagprefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <asp:PlaceHolder ID="PlaceHolder1" runat="server">        
        <%: Scripts.Render("~/bundles/JQuery") %>          
        <%: Scripts.Render("~/bundles/JQueryUI") %>  
        <%: Styles.Render("~/bundles/Formly/css") %>
        <%: Scripts.Render("~/bundles/Formly") %>
		
        <%: Styles.Render("~/bundles/Datatables/css") %>
        <%: Scripts.Render("~/bundles/Datatables") %>
    </asp:PlaceHolder>

    <script type="text/javascript" lang="javascript" src="../Scripts/Formly/FormlyHelper.js"></script>
    <script type="text/javascript" lang="javascript" src="../Scripts/GrayParrot.Core.js"></script> 
    <script type="text/javascript" lang="javascript" src="../Scripts/GrayParrot.AngularJS.Directives.Fileupload.js"></script> 
    <script type="text/javascript" lang="javascript" src="../Scripts/GrayParrot.AngularJS.Directives.DateTimePicker.js"></script> 
    <script type="text/javascript" lang="javascript" src="../Scripts/GrayParrot.AngularJS.js"></script> 
    <script type="text/javascript" lang="javascript" src="../Scripts/GrayParrot.DataTables.js"></script> 
    <script type="text/javascript" lang="javascript" src="../Scripts/GrayParrot.Modals.js"></script> 
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <!-- 
        Sitemap Menu item:
        <siteMapNode url="~/ReportMagazzino.aspx" title="ReportMagazzino" description="ReportMagazzino" image="fa-laptop" id="ReportMagazzino"/>
    -->
    <section class="panel">
	    <header class="panel-heading">
			<b>Report Magazzino</b>
		</header>

        <a class="collapsed" data-toggle="collapse" href="#collapseSetting">
            <h4 class="fa  fa-search"> Filters</h4>
        </a>
        <section id="collapseSetting" class="collapse" style="height: 0px;">
            <div class="collapse-boby" style="padding:0">
                <% HttpContext.Current.Response.Write(this.JQDTable.RenderExternalFilters()); %>
            </div>
        </section>

		<div class="panel-body">

            <!-- PUT YOUR CONTENT HERE -->
            <iframe id='iframeCrud' frameborder="0" style="width:800px; height:450px; display:none"></iframe>
            <div id="crudDialog" title="" style="display:none"></div>

            <div ng-app="formlyExample" ng-controller="MainCtrl as vm" name="divContainer" id="divContainer">
                <div ng-if="vm.loadingData.$$state.status === 0" style="margin:20px 0;font-size:2em">
                    <strong>Caricamento...</strong>
                </div>
                <div ng-if="vm.loadingData.$$status.state !== 0">
                    <form ng-submit="vm.onSubmit()" novalidate id="c">
                        <formly-form model="vm.model" fields="vm.fields" form="vm.form">
                        </formly-form>
                    </form>
                </div>
            </div>

            <cc1:JQDataTable ID="JQDTable" runat="server" 
                    SelectionMode="Single" 
                    RenderScripts="false" 
                    BootstrapClasses="table table-hover table-bordered table-condensed">
                <FeaturesConfig>
                    <Features>
                        <cc1:Searching Value="Both" ExternalFilters="true">
                            <Filters>
                                <cc1:ColumnFilter ColumnName="Articolo" Type="Text" />
                                <cc1:ColumnFilter ColumnName="Cancellato" Type="Text" />
                            </Filters>
                        </cc1:Searching>
                        <cc1:AutoWitdh Value="true" />
                        <cc1:ScrollY Value="500" ScrollCollapse="true" />
                        <cc1:LengthChange Value="false" />
                        <cc1:Paging PagingType="FullNumbers" PageLength="8" />
                    </Features>
                </FeaturesConfig>
                <ControllerConfig Url="/api/Magazzino/Load" LoadingMode="OnDemand">
                    <Validation Message="Indicare il cliente..." FormId="formlyForm" />
                    <ControllerParameters>
                        <cc1:ControllerParameter Name="formly_1_asyncselect_IdCustomer_0" Alias="IdCliente" />
                    </ControllerParameters>
                </ControllerConfig>
                <ColumnsConfig Key="Id">
                    <Columns>
                        <cc1:TextColumn Name="Id" Header="Id" Visible="false" />
                        <cc1:TextColumn Name="Articolo" Header="Articolo" Width="1500" />
                        <cc1:NumericColumn Name="Giacenza" Header="Giacenza" Width="30" />
                        <cc1:NumericColumn Name="Prenotata" Header="Prenotata" Width="30" />
                        <cc1:ActionColumn>
                            <Actions>
                                <cc1:ActionIcon Icon="fa fa-search" Callback="ShowImage" />
                            </Actions>
                        </cc1:ActionColumn>
                    </Columns> 
                </ColumnsConfig>
<%--                <Buttons>
                    <cc1:CrudAddButton Text="Aggiungi" Callback="LoadAddDialog" />
                    <cc1:CrudEditButton Text="Modifica" Callback="LoadEditDialog" />
                    <cc1:CrudDeleteButton Text="Cancella" Callback="DeleteDialog" />
                </Buttons>--%>
            </cc1:JQDataTable>
		</div>
	</section>

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="LocaJavascript" runat="server">
     <% HttpContext.Current.Response.Write(this.JQDTable.RenderScriptsManually()); %>

<script type="text/javascript">
    var settings = new FormlySettings();
    settings.container = '#divContainer';

    settings.setLoad(settings.createGetConfig('/api/Magazzino/LoadFieldsReportMagazzino'));
    FormlyManager(settings);

    function ShowImage(obj) {
        $("#iframeCrud").prop('src', '/operazioni/ShowImage.aspx?id=' + obj.IdArticolo).appendTo("#crudDialog");
        $("#iframeCrud").width(800);
        $("#iframeCrud").height(450);
        $("#iframeCrud").show();

        m_dialog = $("#crudDialog").dialog({
            title: 'Dettaglio Articolo',
            width: 'auto',
            height: 'auto',
            modal: true,
            close: function () {
                $("#iframeCrud").width(1000);
                $("#iframeCrud").height(550);
                $("#iframeCrud").contents().remove();
                $('#iframeCrud').hide();
            }
        });
    }
</script>
</asp:Content>